package com.seal.commons.copiers.orika;

import ma.glasnost.orika.MapperFactory;

/**
 * 功能描述: <br/>
 *
 * @author huangyong
 * @date: 2020-05-31 22:12<br/>
 * @since JDK 1.8
 */
public class OrikaMapperFactory {

    private static volatile MapperFactory INSTANCE = null;

    public static MapperFactory getMapperFactory(OrikaMapper orikaMapper) {
        if (INSTANCE == null) {
            synchronized (OrikaMapperFactory.class) {
                if (INSTANCE == null) {
                    INSTANCE = orikaMapper.getFactory();
                }
            }
        }
        return INSTANCE;
    }

    public static MapperFactory getMapperFactory() {
        if (INSTANCE == null) {
            synchronized (OrikaMapperFactory.class) {
                if (INSTANCE == null) {
                    INSTANCE = new OrikaMapper().getFactory();
                }
            }
        }
        return INSTANCE;
    }

}